package kr.inani.android.view;
import kr.inani.R;
import kr.inani.android.BookSearchActivity;
import kr.inani.android.MainActivity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;


public class AddBookView extends BookView implements OnClickListener 
{

//	public AddBookView(Context context, AttributeSet attrs, int defStyle) {
//		super(context, attrs, defStyle);
//		init();
//	}
//
//	public AddBookView(Context context, AttributeSet attrs) {
//		super(context, attrs);
//		init();
//	}

	public AddBookView(Context context) {
		super(context);
		init();
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent(getContext(), BookSearchActivity.class);
		intent.putExtra("SHELF_NAME", getShelfName());
		((MainActivity)getContext()).startActivityForResult(intent, MainActivity.REQUEST_CODE_FOR_INSERT_BOOK);
	}
	
	/////////////////////////// private /////////////////////////

	private void init() {
		setBackgroundResource(R.drawable.dotted_rect);
		setOnClickListener(this);
	}
	
	private String getShelfName()
	{
		return (String) getTag();
	}
	
}
